-
-
Notifications
You must be signed in to change notification settings - Fork 195
London | May-2025 | Ikenna Agulobi | Structuring and Testing Data sprint-3 #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Your PR is created against CYF's |
Hi @cjyuan , I've updated my PR to point to CodeYourFuture:main as requested. Please let me know if anything else needs to be changed. Thank you! |
This branch was created from branch "coursework/sprint-2" instead of from Can you rebase your The following instructions assume you had created a branch named Important:
1. Open Your Cloned Repository in VSCode and Start a Terminal in VSCode.VSCode will start the terminal in the top-level folder of the current project. 2. Switch to the branch you want to rebase (
|
… message for password already been used
4ad048f
to
79fcbe9
Compare
Hi @cjyuan , thank you for your feedback. I've now rebased the coursework/sprint-3 branch onto main as you requested, and I have removed the unintended changes from sprint-2 and I've also force-pushed the updated branch to GitHub. |
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
Outdated
Show resolved
Hide resolved
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
Outdated
Show resolved
Hide resolved
const isValidPassword = require("./password-validator.js"); | ||
test("password has at least 5 characters", () => { | ||
// Arrange | ||
const password = "12345"; | ||
const password = "Abc1!"; | ||
// Act | ||
const result = isValidPassword(password); | ||
// Assert | ||
expect(result).toEqual(true); | ||
} | ||
); No newline at end of file | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check only ensure the function can return true
when the password is correct; it does not ensure the function can return false
when a password does not meet the condition specified.
The same applies to the other tests in this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added test cases to check that my function returns false when password is too short, has no special character, has no number, no upper case and has no lower case as you've requested. Thanks!
…er or greater or equals to 360
…e and make it easier to maintain
…g too short, no special character, no number, no upper or lower case.
Hi @cjyuan , I've implemented all the changes you requested. Could you please take a look. Thank you 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. Well done.
// add your completed function from key-implement here | ||
if (numerator >= denominator) return false; | ||
if(denominator === 0){ | ||
return "Denominator cannot be zero" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a string from a function that is expected to return a Boolean value can make consuming the return value inconvenient.
Consider the alternatives:
- return
false
(to indicate anything divided by 0 is not a proper fraction) - throw an error
@@ -56,3 +56,34 @@ test("password must not be any previous password in the passwords array", ()=> { | |||
const result = isValidPassword(password); | |||
expect(result).toEqual(false); | |||
}); | |||
|
|||
test("fails when password is less than 5 characters", () => { | |||
const password = "A1!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also include a lowercase letter.
You forgot to change label to "Needs review". :P |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
This PR includes my completed exercises for Sprint 3 in the Structuring and Testing Data module.
###The exercises included in this PR:###
1- key-implement
2- mandatory-rewrite
3- mandatory-practice
4- stretch-investigate
Questions
Ask any questions you have for your reviewer.
Hello @cjyuan - I wasn't able to complete the test cases for Card validator in Stretch-investigate. Given that it's not among mandatory exercises, can I come back to it when I have more time as I'm a bit behind?